package com.prj.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@Schema(description = "权限列表查询结果")
public class MenuVO {

    @Schema(description = "id")
    private Integer id;

    @Schema(description = "权限名称")
    private String name;

    @Schema(description = "权限值")
    private String acl;

    @Schema(description = "上级id")
    private Integer parentId;

    @Schema(description = "层级")
    private Integer level;

    @Schema(description = "下级权限")
    private List<MenuVO> children;

    public MenuVO(Integer id, String name, String acl, Integer parentId, Integer level) {
        this.id = id;
        this.name = name;
        this.acl = acl;
        this.parentId = parentId;
        this.level = level;
        this.children = new ArrayList<>();
    }

    public void addChild(MenuVO child) {
        children.add(child);
    }
}

